package cn.gok;

public class SuperWorker extends Worker {
    private float bonus;

    public float getBonus() {
        return bonus;
    }

    public void setBonus(float bonus) {
        if (bonus>=0&&bonus<=1) {
            this.bonus = bonus;
        }else {
            System.out.println("bonus范围在【0,1】之间");
        }
    }

    public SuperWorker(String name, String job, int salary, float bonus) {
        super(name, job, salary);
        this.bonus = bonus;
    }

    @Override
    public int doJob(int months) {
        return (int)(super.doJob(months)*(1+this.bonus));
    }
    public int doJob(int months,int addtionalHours) {
        return (int) (super.doJob(months)+(this.bonus*getSalary()*addtionalHours)/100);
    }
}
